/*
 * Copyright (c) 2011, 张达林
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 * 3. Neither the name of SlotBoard nor the names of its contributors may be used
 *    to endorse or promote products derived from this software without
 *    specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
package cc.gpai.util.slotboard.example;

import java.awt.Color;

import cc.gpai.util.slotboard.StandardSignal;
import cc.gpai.util.slotboard.Slot;
import cc.gpai.util.slotboard.SlotBoard;
import cc.gpai.util.slotboard.SlotImpl;

public class PropertiesExample {

	/**
	 * @param args
	 */
	@SuppressWarnings("rawtypes")
	public static void main(String[] args) {
		StandardSignal signal1 = new StandardSignal();
		StandardSignal signal2 = new StandardSignal();
		StandardSignal signal3 = new StandardSignal();
		Slot slot1 = new SlotImpl();
		Slot slot2 = new SlotImpl();
		Slot slot3 = new SlotImpl();
		SlotBoard.connect(signal1, slot1);
		SlotBoard.connect(signal2, slot2);
		SlotBoard.connect(signal3, slot3);
		signal1.listener.setProperty("favour color", Color.red);
		signal2.listener.setProperty("favour color", Color.green);
		signal3.listener.setProperty("favour color", Color.blue);
		signal1.listener.setProperty("favour flower", "rose");
		//signal2.listener.setProperty("favour flower", null);
		signal3.listener.setProperty("favour flower", "lily");

		SlotBoard.connect(signal1, slot2);
		SlotBoard.connect(signal1, slot3);
		
		Object col=null;
		System.out.println("What's your favour color?");
		col = signal1.listener.getProperty("favour color");
		System.out.println(col);
		System.out.println("What are your favour colors?");
		col = signal1.listener.getProperties("favour color");
		System.out.println(col);
		System.out.println("What are your favour flowers?");
		col = signal1.listener.getProperties("favour flower");
		System.out.println(col);
	}

}
